/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.wins.vertx.entity;

import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

/**
 * Converter for {@link io.wins.vertx.entity.ConcertTime}.
 *
 * NOTE: This class has been automatically generated from the {@link io.wins.vertx.entity.ConcertTime} original class using Vert.x codegen.
 */
public class ConcertTimeConverter {

  public static void fromJson(final JsonObject json, final ConcertTime obj) {
    if (json.getValue("parentId") instanceof String) {
      obj.setParentId((String)json.getValue("parentId"));
    }
    if (json.getValue("date") instanceof String) {
      obj.setDate((String)json.getValue("date"));
    }
    if (json.getValue("time") instanceof JsonArray) {
      obj.setTime(json.getJsonArray("time").toString());
    }
  }

  public static void toJson(final ConcertTime obj, final JsonObject json) {
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getParentId() != null) {
      json.put("parentId", obj.getParentId());
    }
    if (obj.getDate() != null) {
      json.put("date", obj.getDate());
    }
    if (obj.getTime() != null) {
      json.put("time", new JsonArray(obj.getTime()));
    }
  }
}